﻿<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
	<meta name="apple-mobile-web-app-capable" content="yes"/>
	<title>Icon Container (Multi - Below)</title>

	<script type="text/javascript" src="../../../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base','IconContainer']"></script>
	<script type="text/javascript" src="../../../../../dojo/dojo.js" data-dojo-config="async: false, parseOnLoad: true,  has: {'dojo-bidi': true }"></script>

	<script type="text/javascript">
		require([
			"dijit/registry",		
			"doh/runner",
			"dojo/dom",
			"dojo/ready",
			"dojo/query",
			"dojox/mobile/IconContainer",			
			"dojox/mobile/IconItem",
			"dojox/mobile",
			"dojox/mobile/compat",
			"dojox/mobile/parser"
			], function(registry,runner,dom,ready,query){					
				ready(function(){
					runner.register("Bidi IconContainer", [
						{
							name: "mobile",
							timeout: 2000,					
							runTest: function(){
								var LRE = String.fromCharCode(8234);					
								var RLE = String.fromCharCode(8235);					
								var firstListItem = registry.byId('first_li');
								var secondListItem = registry.byId('second_li');
								var deferred = new runner.Deferred();
								
								runner.is(RLE, firstListItem.labelNode.innerHTML.charAt(0), "label node of first list item inherits textDir attribute from IconContainer");
								runner.is(RLE, firstListItem.paneWidget.labelNode.innerHTML.charAt(0), "paneWidget node of first list item inherits textDir attribute from IconContainer");
								
								runner.is(LRE, secondListItem.labelNode.innerHTML.charAt(0), "label node of second list item textDir has been set to 'ltr' explicitly");
								runner.is(LRE, secondListItem.paneWidget.labelNode.innerHTML.charAt(0), "paneWidget node of second list item textDir has been set to 'ltr' explicitly");

								runner.assertTrue(firstListItem._onTouchStartHandle, "'startup' call chain was successful, widget icon mouse click handle has been initialized");
													   
								deferred.getTestCallback(function(){
									firstListItem.set("textDir","ltr");
									runner.is(LRE, firstListItem.labelNode.innerHTML.charAt(0), "the text direction of label node of first list item has been changed on the fly");	                        
									runner.is(LRE, firstListItem.paneWidget.labelNode.innerHTML.charAt(0), "the text direction of paneWidget node of first list item has been changed on the fly");                        
									firstListItem.set("textDir","rtl");
								})();
															
								return deferred;						
							}
						}
					]);	 			
					
					runner.register("log", function(){
						dom.byId('failures').innerHTML = runner._failureCount;
						dom.byId('errors').innerHTML = runner._errorCount;
					});

					runner.run();
				});
		});		
    </script>
	<style>
		.box {
			border: 1px solid #A7C0E0;
			width: 300px;
			height: 250px;
			background-image: url(../../images/widget-bg.png);
			background-repeat: no-repeat;
			background-color: white;
		}
	</style>
</head>
<body style="visibility:hidden;">
	<div id="view1" data-dojo-type="dojox/mobile/View">
		<h1 data-dojo-type="dojox/mobile/Heading">Icon Container (Multi - Below)</h1>
		<ul data-dojo-type="dojox/mobile/IconContainer" data-dojo-props='textDir:"rtl" '>
			<li id="first_li" data-dojo-type="dojox/mobile/IconItem" data-dojo-props='label:"app1!!", icon:"../../images/icon-1.png", lazy:true '><div class="box"></div></li>
			<li id="second_li" data-dojo-type="dojox/mobile/IconItem" data-dojo-props='label:"app2!!", icon:"../../images/icon-1.png", lazy:true,textDir:"ltr" '><div class="box"></div></li>
			<li data-dojo-type="dojox/mobile/IconItem" data-dojo-props='label:"app3!!", icon:"../../images/icon-1.png", lazy:true'><div class="box"></div></li>
			<li data-dojo-type="dojox/mobile/IconItem" data-dojo-props='label:"href?", icon:"../../images/icon-1.png", href:"../../test_RoundRectList.html", transition:"slide"'></li>
		</ul>
	</div>
	<br>Errors:&nbsp;<span id="errors">?</span>
	<br>Failures:&nbsp;<span id="failures">?</span>	
</body>
</html>
